<!--#include file="header.html"-->
<div class="layui-row" style="margin-top: 20px;">
    <!--#include file="left.html"-->
 
    <div class="layui-col-md9 layui-col-md-offset1">
        <span class="layui-breadcrumb">
            <a href="/index.html">首页</a>
            <a href="/user.html">会员中心</a>
            <a href="/user-dev.html">开发配置</a>
            <a><cite>详情</cite></a>
        </span>

        <fieldset class="layui-elem-field" style="margin-top: 20px;">
            <legend style="font-size: 14px;">API 编号</legend>
            <div class="layui-field-box" style="color: #393D49" id="app_id"> </div>
        </fieldset>

        <fieldset class="layui-elem-field" style="margin-top: 40px;">
            <legend style="font-size: 14px;">API 密钥</legend> <div class="layui-field-box" id="app_key"> </div>
        </fieldset>

        <fieldset class="layui-elem-field" style="margin-top: 40px;">
            <legend style="font-size: 14px;">API 创建时间</legend> <div class="layui-field-box" id="created"> </div>
        </fieldset>

        <fieldset class="layui-elem-field" style="margin-top: 40px;">
            <legend style="font-size: 14px;">API 有效时间</legend>
            <div class="layui-field-box" id="expired"> </div>
        </fieldset>

        <!--<fieldset class="layui-elem-field" style="margin-top: 40px;">
            <legend style="font-size: 14px;">总调用次数</legend>
            <div class="layui-field-box"> </div>
        </fieldset>-->

    </div>
</div>
<!--#include file="footer.html"-->
<script>
layui.use(['layer', 'jquery', 'element'], function() { 
    var $ = jQuery;

    if (!has_login()) { 
        top.location.href = "/login.html";
    }
    
    var auth_string = window.localStorage.getItem('authorization');
    $.ajax({
        url: get_api_url("auth/users/dev"),
        headers: {
            "Authorization": 'Bearer ' + auth_string 
        },
        type: "GET",
        dataType: "json",
        contentType: "application/json; charset=utf-8",
        success: function(res) { 
            if (res.code !== 0) { 
                layer.alert(res.message, function() { 
                    window.localStorage.removeItem('authorization');
                    top.location.href = '/login.html';
                });
            }  
            
            var result = res.result;
            $("#app_id").html(result.id);
            $("#app_key").html(result.code);
            $("#created").html(result.created);
            $("#expired").html("2099-12-31 23:59:59");
        }
    });

});
</script>
